package coredb;

/** checking inputs like PAN for format compliance
 *
 * @author lol
 */
public class Validation {

    public static boolean validPan(String panno) {
        if (panno.length() != 10) {
            return false;
        }

        String f = panno.substring(0, 5);
        String s = panno.substring(5, 9);
        char l = panno.charAt(9);
        int ss;
        boolean tf = true;

        for (int i = 0; i < 5; i++) {
            char ch = panno.charAt(i);
            if (((int) ch >= (int) 'A' && (int) ch <= (int) 'Z') || ((int) ch >= (int) 'a' && (int) ch <= (int) 'z')); else {
                tf = false;
            }

        }
        try {
            ss = Integer.parseInt(s);
        } catch (Exception e1) {
            tf = false;
        }

        if (((int) l >= (int) 'A' && (int) l <= (int) 'Z') || ((int) l >= (int) 'a' && (int) l <= (int) 'z')); else {
            tf = false;
        }

        return tf;


    }
}
